<%@ include file="/common/taglibs.jsp"%>

<div class="featured">
<div class="content">

	<div class="sm-w">
		<h1>Featured Stories</h1>
	
		<c:set var="feature" value="${minFeature}"/>
		<c:if test="${param.f != null}">
			<c:set var="feature" value="${param.f}"/>
		</c:if>
		
		<ul id="featuredposts" class="featuredposts">
	        <c:forEach var="article" items="${featuredArticles}" varStatus ="menuStatus">
				<li>
					<a href="#" rel="feature${article.id}" <c:if test= "${feature == article.id}"> class="selected"</c:if> >
					</a>
				</li>
			</c:forEach>
		</ul>
		<div class="clear"></div>
	</div>

	<c:forEach var="article" items="${featuredArticles}" varStatus ="articleStatus">
			
			<c:set var="articleContent">
				<authz:authorize ifAnyGranted="ROLE_ANONYMOUS">
					content_${article.titleLine}_${article.id}_${application_theme}.xhtml
				</authz:authorize>
				<authz:authorize ifAnyGranted="ROLE_USER, ROLE_ADMIN">
					getArticleContent${application_theme}.html?id=${article.id}
				</authz:authorize>
			</c:set>
			
			<div style="display: <c:if test= "${feature == article.id}">block</c:if>;" id="feature${article.id}" class="featuredposts_content">
				<div class="thumb"><a href="${articleContent}">
						<img width="180&amp" height="130&amp" src="<c:url value="/thumbnail?id=${article.id}"/>" alt="${article.title}"></a>
				</div>
				<div class="fpost">
					<h2><a href="${articleContent}" title="${article.title}">${article.title}</a></h2>
					<p>
						${article.overview}
					</p>
					<span class="read"><a href="<c:out value="${articleContent}"/>"><strong><fmt:bundle basename="ApplicationResources"><fmt:message key="feature.read.more"/></fmt:bundle></strong></a> (Read ${article.viewsNumber} times)</span>
					<span class="docomment"><a href="<c:out value="${articleContent}"/>/#respond"><strong>Add a comment</strong></a> - <a href="<c:out value="${articleContent}"/>#comments"><strong>${article.commentsNumber} users</strong></a> commented on this post</span>	
				</div>
			</div>

	</c:forEach>
	
	<script type="text/javascript">
		var featuredposts=new ddtabcontent("featuredposts");
		featuredposts.setpersist(false);
		featuredposts.setselectedClassTarget("link");
		featuredposts.init(7500);
	</script>

</div><div class="clear"></div>
</div><div class="clear"></div>
<div class="featured-footer"></div>

<div id="leftcolumn">

	<c:forEach var="type" items="${types}" varStatus="typeCounter">
		<c:if test="${typeCounter.index%2==0 && not empty type.articles}">
			<div class="cat-widget" id="${type.name}">
				<h3><a href="getArticlesBytype.html?typeName=${article.type.name}" title="${type.name}">${type.name}</a><a href="#minimize" class="minimize"></a><a href="#close" class="close"></a></h3>
			    		    
			    <div class="container">
			    
			    	<c:set var="moreArticles">
	    				<h4>More Stories<a href="#more" class="plus"></a><a href="#less" class="minus"></a></h4>
						<ul class="more_stories">
								<c:set var="contor" value="0"></c:set>
								<c:forEach var="article" items="${articles}" varStatus="articleCounter">
									
									<c:if test="${article.type.id==type.id}">
										
									    <c:set var="contor" value="${contor + 1}"></c:set>
									    	<c:if test="${contor != 1}">
												<li>
													<a href="<c:out value="${articleContent}"/>" title="${article.title}" class="animate">
													<span class="smallimg">
														<img width="22&amp" height="22" src="<c:url value="${path_theme}/${article.type.urlmax}"/>" title="${article.title}"/>
													</span>		
													<span class="smalltitle">${article.title}</span>
													<div class="clear"></div>
													</a>
												</li>
											</c:if>
									</c:if>
								</c:forEach>

						</ul>		
			    	</c:set>
			    
			    
					<c:set var="contor" value="0"></c:set>
					<c:forEach var="article" items="${articles}" varStatus="articleCounter">
						
						<c:if test="${article.type.id==type.id}">
							
						    <c:set var="contor" value="${contor + 1}"></c:set>
						
							<c:set var="articleContent">
								<authz:authorize ifAnyGranted="ROLE_ANONYMOUS">
									content_${article.titleLine}_${article.id}_${application_theme}.xhtml
								</authz:authorize>
								<authz:authorize ifAnyGranted="ROLE_USER, ROLE_ADMIN">
									getArticleContent${application_theme}.html?id=${article.id}
								</authz:authorize>
							</c:set>
								
							<c:if test="${contor == 1}">		
								<div class="cpost">				
									<div class="thumb">
										<a href="<c:out value="${articleContent}"/>">
											<c:if test="${not empty article.thumbnail}">
												<img width="100&amp" height="75&amp" src="<c:url value="/thumbnail?id=${article.id}"/>" alt="${article.title}" title="${article.title}"/>						
											</c:if>
											<c:if test="${empty article.thumbnail}">
												<img width="100&amp" height="75&amp" src="<c:url value="${path_theme}/images/feature_img_jr.gif"/>" alt="${article.title}" title="${article.title}"/>
											</c:if>
										</a>
									</div>
									<div class="info">		
										<a href="<c:out value="${articleContent}"/>" title="${article.title}" class="dark_perm">${article.title}</a>
										<p>${article.overview}</p>				
										<span class="ex">
										<a href="<c:out value="${articleContent}"/>" class="cont">Continue</a>
										<a href="<c:out value="${articleContent}"/>#comments" class="comm">${article.commentsNumber} Comments</a>
										</span><div class="clear"></div>				
									</div>
									<div class="clear"></div>
								</div>	
								${moreArticles}
							</c:if>						
						</c:if>
					</c:forEach>
				</div>
				<div class="footer"></div>	
			</div>
		</c:if>
	</c:forEach>

</div>

<div id="rightcolumn">

	<c:forEach var="type" items="${types}" varStatus="typeCounter">
		<c:if test="${typeCounter.index%2==1 && not empty type.articles}">
			<div class="cat-widget" id="${type.name}">
				<h3><a href="getArticlesBytype.html?typeName=${article.type.name}" title="${type.name}">${type.name}</a><a href="#minimize" class="minimize"></a><a href="#close" class="close"></a></h3>
			    
			    <div class="container">
			    
			    	<c:set var="moreArticles">
	    				<h4>More Stories<a href="#more" class="plus"></a><a href="#less" class="minus"></a></h4>
						<ul class="more_stories">
								<c:set var="contor" value="0"></c:set>
								<c:forEach var="article" items="${articles}" varStatus="articleCounter">
									
									<c:if test="${article.type.id==type.id}">
										
									    <c:set var="contor" value="${contor + 1}"></c:set>
									    	<c:if test="${contor != 1}">
												<li>
													<a href="<c:out value="${articleContent}"/>" title="${article.title}" class="animate">
													<span class="smallimg">
														<img width="22&amp" height="22&amp" src="<c:url value="${path_theme}/${article.type.urlmax}"/>" title="${article.title}"/>
													</span>		
													<span class="smalltitle">${article.title}</span>
													<div class="clear"></div>
													</a>
												</li>
											</c:if>
									</c:if>
								</c:forEach>

						</ul>		
			    	</c:set>
			    
			    
					<c:set var="contor" value="0"></c:set>
					<c:forEach var="article" items="${articles}" varStatus="articleCounter">
						
						<c:if test="${article.type.id==type.id}">
							
						    <c:set var="contor" value="${contor + 1}"></c:set>
						
							<c:set var="articleContent">
								<authz:authorize ifAnyGranted="ROLE_ANONYMOUS">
									content_${article.titleLine}_${article.id}_${application_theme}.xhtml
								</authz:authorize>
								<authz:authorize ifAnyGranted="ROLE_USER, ROLE_ADMIN">
									getArticleContent${application_theme}.html?id=${article.id}
								</authz:authorize>
							</c:set>
								
							<c:if test="${contor == 1}">		
								<div class="cpost">				
									<div class="thumb">
										<a href="<c:out value="${articleContent}"/>">
											<c:if test="${not empty article.thumbnail}">
												<img width="100&amp" height="75&amp" src="<c:url value="/thumbnail?id=${article.id}"/>" alt="${article.title}" title="${article.title}"/>						
											</c:if>
											<c:if test="${empty article.thumbnail}">
												<img width="100&amp" height="75&amp" src="<c:url value="${path_theme}/images/feature_img_jr.gif"/>" alt="${article.title}" title="${article.title}"/>
											</c:if>
										</a>									</div>
									<div class="info">		
										<a href="<c:out value="${articleContent}"/>" title="${article.title}" class="dark_perm">${article.title}</a>
										<p>${article.overview}</p>				
										<span class="ex">
										<a href="<c:out value="${articleContent}"/>" class="cont">Continue</a>
										<a href="<c:out value="${articleContent}"/>#comments" class="comm">${article.commentsNumber} Comments</a>
										</span><div class="clear"></div>				
									</div>
									<div class="clear"></div>
								</div>	
								${moreArticles}
							</c:if>						
						</c:if>
					</c:forEach>
				</div>
				<div class="footer"></div>	
			</div>
		</c:if>
	</c:forEach>

</div>


<div class="clear"></div>